Usage: Rscript -e " rmarkdown::render( ‘automanualepm.Rmd’, output_file = ‘./automanualepm.html’ )" Usage: R; rmarkdown::render( ‘automanualepm.Rmd’, output_file = ‘./automanualepm.html’ )
EPM analysis corresponding to https://arxiv.org/abs/2309.03980
address review comments for mask sensitivity
Note that some manual labels were missing that causes epm =0 downstream. Dropping these for now.
manualdataset <- read.csv( "epmstats/widejoin.csv", na.strings=c(".", "NA", "", "?"), strip.white=TRUE, encoding="UTF-8")
autodataset <- read.csv("autostats/widejoin.csv", na.strings=c(".", "NA", "", "?"), strip.white=TRUE, encoding="UTF-8")
epmmanualsubset <- subset(manualdataset, FeatureID == 'epm' & LabelID> 0 & Mean > 0 )
epmautosubset <- subset(autodataset , FeatureID == 'epm' & LabelID> 0 )
UID encodes patient id and time point LabelID is the ROI label
automanualdata = merge(x = epmmanualsubset , y = epmautosubset , by = c("UID","LabelID"),suffixes=c("man","aut"))
#cbind(as.character(automanualdata$UID),automanualdata$LabelID,automanualdata$Meanman,automanualdata$Meanaut)
plot and compute correlation
# Pearson correlation between 2 variables
mypearson = cor(automanualdata$Meanman ,automanualdata$Meanaut)
#make the main plot
plot(automanualdata$Meanman,automanualdata$Meanaut, main=sprintf("EPM correlation, r = %.2f", mypearson), xlab='Manual', ylab='Auto',
cex.main=1.5, #change font size of title
cex.lab=1.5, #change font size of axis labels
cex.axis=1.5) #change font size of axis text
#add linear trend
abline(lm(automanualdata$Meanaut~automanualdata$Meanman))
#compute trend line
m1 = lm(automanualdata$Meanman~automanualdata$Meanaut)
line.fmt = list(dash="solid", width = 1.5, color=NULL)
fig <- plot_ly(
automanualdata, x = ~Meanman, y = ~Meanaut,type="scatter",
# Hover text:
text = ~paste("UID: ", UID, '<br>LabelID:', LabelID)
#color = ~carat, size = ~carat
) # %>% add_trace(automanualdata,x = ~Meanman, y = predict(m1), mode = "lines")
#fig = add_lines(fig, x=myxi , y=predict(m1), line=line.fmt, name="Linear")
fig = layout(fig,xaxis = list(title = 'Manual'), yaxis = list(title = 'Automatic'))
fig
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode